﻿<?php include './connection.php';  ?>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html>
    <head>
        <link href="style.css" rel="stylesheet" type="text/css"/>
        <title>Thực hành PHP</title>
    </head>
    
    <body>
        <h1> Bảng thông tin sinh viên</h1>
        <?php
        $sql='select * from students';
        $students=  query($sql);
        ?>
        
        <table class="tab_1">
            <tr>
                <td width="50">ID</td>
                <td width="255">Name</td>
                <td width="50">Sex</td>
                <td width="255">Email</td>
                <td width="255">Address</td>
                
            </tr>
        </table>
        <?php foreach( $students as $student):?>
        <table class="tab_2">
             <tr>
                <td width="60"><?php echo $student['ID']?></td>
                <td width="300"><?php echo $student['NAME']?></td>
                <td width="50"><?php echo $student['SEX']?></td>
                <td width="200"><?php echo $student['EMAIL']?></td>
                <td width="255"><?php echo $student['ADDRESS']?></td>
                
            </tr>
        </table>
        <?php endforeach;?>
        
        
        <div class="input">
            <form action="insert.php" method="POST" >
                <h3>Nhập thông tin sinh viên</h3>
                
                Name:<input type="text" name="name"/>
                Sex:<input type="text" name="sex"/>
                Email:<input type="text" name="email"/>
                Address:<input type="text" name="address"/>
                <input type="submit" name="submit" value="Nhập"/>
                <input type="reset" name="reset" value="xóa"/>
            </form> 
        </div>
        

        <hr/>
        <h1> Bảng thông tin Nhân viên</h1>
        <?php
        $sql='select * from staffs';
        $staffs=  query($sql);
        ?>
        
        <table class="tab_1">
            <tr>
                <td width="50">ID</td>
                <td width="300">Name</td>
             
                
            </tr>
        </table>
        <?php foreach( $staffs as $staff):?>
        <table class="tab_2">
             <tr>
                <td width="60"><?php echo $staff['ID']?></td>
                <td width="300"><?php echo $staff['NAME']?></td>
                
                
            </tr>
        </table>
        <?php endforeach;?>
        
        
      
    </body>
</html>